#include "RectangleCenter.h"


RectangleCenter::RectangleCenter(void) : Filter(1,1)
{
	outputs[0] = cv::Mat(1,2, CV_32SC1);
}


RectangleCenter::~RectangleCenter(void)
{
}

void RectangleCenter::Process()
{
	outputs[0] = cv::Mat(inputs[0]->rows, 2, CV_32SC1);

	for (int i = 0; i < inputs[0]->rows; ++i)
	{
		int *in = inputs[0]->ptr<int>(i);
		int *out = outputs[0].ptr<int>(i);

		out[0] = in[0] + in[2] / 2.0 + 0.5;
		out[1] = in[1] + in[3] / 2.0 + 0.5;
	}
}